<div class="main">
  <ul>
    <li>文件总数：{{articleList.length}}篇</li>
    <ng-container *ngFor="let item of articleList;let i = index;">
      <li (click)="backfillForm(item, $event)">
        <span>
          【{{i + 1}}】{{item.title}}
          <i class="fa" [ngClass]="{'fa-file-pdf-o': item.type === 1,'fa-cog': item.type === 2}"></i>
        </span>
        <i class="fa fa-minus-circle" (click)="delete(item)" title="删除文件"></i>
      </li>
    </ng-container>
  </ul>
  <form [formGroup]="editeForm">
    <div class="segment">
      <span>名 称：</span>
      <input type="text" pInputText formControlName="title" />&nbsp;
      <i class="fa fa-plus-circle fa-lg" (click)="resetModule()" title="新增文件"></i>
    </div>
    <div class="segment">
      <span>类 型：</span>
      <p-dropdown [style]="{'width': '400px'}" [options]="typeList" [(ngModel)]="typeSelected" formControlName="type"
        optionLabel="label"></p-dropdown>
    </div>
    <div class="segment" *ngIf="typeSelected.value === 2">
      <span>描 述：</span>
      <input type="text" pInputText formControlName="description" />
    </div>
    <div class="segment" *ngIf="typeSelected.value === 2">
      <span>链 接：</span>
      <input type="text" pInputText formControlName="link" />
    </div>
    <div class="segment" *ngIf="typeSelected.value === 2">
      <span>图 标：</span>
      <input type="file" pInputText formControlName="logo" #logo />
    </div>
    <div class="segment">
      <span>作 者：</span>
      <input type="text" pInputText formControlName="author" />
    </div>
    <div class="segment">
      <span>邮 箱：</span>
      <input type="text" pInputText formControlName="email" />
    </div>
    <div class="segment">
      <span>移动电话：</span>
      <input type="text" pInputText formControlName="phone" />
    </div>
    <div class="segment">
      <span>主体内容（软件介绍内容/文章内容）：</span>
      <p-editor [(ngModel)]="editeForm.value.content" [style]="{'height':'420px'}" formControlName="content">
      </p-editor>
    </div>
    <div *ngIf="typeSelected.value === 2" class="segment">
      <span>更新内容（主要介绍软件版本更新内容）：</span>
      <p-editor [(ngModel)]="editeForm.value.update_content" [style]="{'height':'320px'}"
        formControlName="update_content">
      </p-editor>
    </div>
    <div class="button-groups">
      <button pButton type="submit" class="ui-button-success" icon="fa fa-save" label="保存" (click)="save()"></button>
      <button pButton type="button" icon="fa fa-reply" label="取消"></button>
    </div>
  </form>
</div>
<p-confirmDialog></p-confirmDialog>
